package com.wkck.controller.admin;

import com.wkck.VO.PageResult;
import com.wkck.VO.UserResumesInfoUnIncludeOnlineResumesVo;
import com.wkck.dto.LResumeBackendQueryConditionsDto;
import com.wkck.result.Result;
import com.wkck.service.LResumeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: CK
 * @Date: 2024/02/15/23:03
 * @Description:
 */
@Api(tags = "平台简历")
@Slf4j
@CrossOrigin
@RequestMapping("/platformResumeBg")
@RestController
public class PlatformResumesBgController {

    @Autowired
    private LResumeService resumeService;

    /***
    * @Author: CK
    * @Date: 2024/3/27
    * @Param: [dto]
    * @Description: 得到系统中所有简历
    */
    @PostMapping("/get-system-platform-resumes")
    @ApiOperation(value = "得到系统中所有简历")
    public Result<PageResult> getAllUsersPlatformResume(@RequestBody LResumeBackendQueryConditionsDto dto) {
        log.info("得到系统中所有简历 ====> {}", dto);
        return Result.success(resumeService.getAllUsersPlatformResume(dto));
    }

    /****
    * @Author: CK
    * @Date: 2024/3/27
    * @Param: [id]
    * @Description: 删除用户平台简历信息
    */
    @DeleteMapping("/remove-user-resumes/{id}")
    @ApiOperation(value = "删除用户平台简历信息")
    public Result<Boolean> removeUserPlatformResumeInfo(@PathVariable Long id) {
        log.info("需要删除的平台简历信息: {}", id);
        return Result.success(resumeService.deleteUserResumeById(id));
    }

    /***
    * @Author: CK
    * @Date: 2024/3/28
    * @Param: [resumeId, userId]
    * @Description: 根据用户id和简历id得到简历信息
    */
    @GetMapping("/get-info/{resumeId}")
    @ApiOperation(value = "根据用户id和简历id得到简历信息")
    public Result<UserResumesInfoUnIncludeOnlineResumesVo> getUserResumeInfoByUserIdAndResumeId(
            @PathVariable Long resumeId) {
        log.info("{}", resumeId);
        return Result.success(resumeService.getUserResumeInfoByResumeId(resumeId));
    }
}
